package map.coreui.fragment.holder

import android.view.View
import android.widget.TextView
import com.baidu.mapapi.search.sug.SuggestionResult
import com.baidu.mapapi.utils.DistanceUtil
import com.zjw.zy.R
import com.zjw.zy.base.BaseViewHolder
import com.zjw.zy.utils.ResourcesUtils
import map.bean.SuggestInfoWrap

/**
 * @author     ：zhong.jw
 * @date       ：Created in 2022/10/25 10:25
 * @description：
 */
class SuggestSearchHolder(item: View) :
    BaseViewHolder<SuggestInfoWrap>(item) {

    private val title: TextView by lazy { findViewById(R.id.suggest_search_item_title) }
    private val address: TextView by lazy { findViewById(R.id.suggest_search_item_address) }
    private val tag: TextView by lazy { findViewById(R.id.suggest_search_item_tag) }
    private val distance: TextView by lazy { findViewById(R.id.suggest_search_item_distance) }

    override fun onBindListener() {

    }

    override fun onBindData(data: SuggestInfoWrap?) {
        data?.let {
            title.text = data.suggestionInfo.key
            address.text = data.suggestionInfo.address
            tag.text = data.suggestionInfo.tag
            if (data.suggestionInfo.uid.isNotEmpty()) {
                distance.text =
                    ResourcesUtils.getString(R.string.suggest_item_distance, data.distance / 1000)
            }
        }
    }
}